package cn.ming.springbootdynamicdatasourcedemo.controller;

import cn.ming.springbootdynamicdatasourcedemo.entiy.Address;
import cn.ming.springbootdynamicdatasourcedemo.entiy.SysUser;
import cn.ming.springbootdynamicdatasourcedemo.service.IAddressService;
import cn.ming.springbootdynamicdatasourcedemo.service.UserService;
import cn.ming.springbootdynamicdatasourcedemo.service.impl.AddressServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * @ClassName UserController
 * @Description XXX类，用于XXX
 * @Author zhuming
 * @Date 2021-08-01 17:04
 * @Version 1.0.0
 */
@RestController
public class UserController {
    @Autowired
    private UserService userService;
    @Autowired
    private IAddressService addressService;
    @GetMapping("/list")
    public List<SysUser> getList() {
        return userService.getList();
    }
    @GetMapping("/add")
    public String addUser() {
         
        userService.addUser();
        return "ok";
    }
    @GetMapping("/listAddress")
    public Object listAddress() {
        List<Address> list = addressService.listAddress();
        return list;
    }
}
